/*************************************************************************
	> File Name: P6568.cpp
	> Author: yufangze
	> Mail: 2224590123@qq.com
	> Created Time: 2025-04-23 14:41:37
 ************************************************************************/
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

#define MAX_N 1000000
long long arr[MAX_N + 5];

int main() {
    int n, k;
    cin >> n >> k;
    for (int i = 1; i <= n; i++) {
        scanf("%lld", &arr[i]);
        arr[i] += arr[i - 1];
    }
    long long ans = 0;
    for (int i = k + 1; i <= n; i++) {
        ans = max(ans, arr[i] - arr[i - k - 1]);
    }
    cout << ans << endl;
    return 0;
}
